package com.api.shopapi.mapper;


import com.api.shopapi.entity.NursingSchedulingNightItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author maochuan
 */
@Repository
@Mapper
public interface NursingSchedulingNightItemMapper {

    @Insert("insert  into nursing_scheduling_night_item " +
            "(NursingSchedulingNightItemCode,NursingSchedulingNightCode,NurseCode,NurseName,NurseAideCode,NurseAideName) " +
            "values (#{nursingSchedulingNightItem.NursingSchedulingNightItemCode} ,#{nursingSchedulingNightItem.NursingSchedulingNightCode} ,#{nursingSchedulingNightItem.NurseCode} ," +
            "#{nursingSchedulingNightItem.NurseName} ,#{nursingSchedulingNightItem.NurseAideCode} ,#{nursingSchedulingNightItem.NurseAideName} )")
    int insert(@Param("nursingSchedulingNightItem") NursingSchedulingNightItem nursingSchedulingNightItem);

    @Update("update nursing_scheduling_night_item set NursingSchedulingNightCode=#{nursingSchedulingNightItem.NursingSchedulingNightCode} ,NurseCode=#{nursingSchedulingNightItem.NurseCode} ,NurseName=#{nurseSchedulingNightItem.NurseName} ,NursingAideCode=#{nursingSchedulingNightItem.NurseAideCode} ,NursingAideName=#{nursingSchedulingNightItem.NurseAideName} where NursingSchedulingNightItemCode=#{nursingSchedulingNightItem.NursingSchedulingNightItemCode}  ")
    int updateByNursingSchedulingNightItemCode(@Param("nursingSchedulingNightItem") NursingSchedulingNightItem nursingSchedulingNightItem);

    @Delete("delete from nursing_scheduling_night_item where NursingSchedulingNightItemCode=#{nursingSchedulingNightItemCode} ")
    int deleteByNursingSchedulingNightItemCode(@Param("nursingSchedulingNightItemCode") String nursingSchedulingNightItemCode);

    @Select("select * from nursing_scheduling_night_item where NursingSchedulingNightItemCode=#{nursingSchedulingNightItemCode} limit 1")
    NursingSchedulingNightItem getByNursingSchedulingNightItemCode(@Param("nursingSchedulingNightItemCode")String nursingSchedulingNightItemCode);

    @Select("select * from nursing_scheduling_night_item where NursingSchedulingNightCode=#{nursingSchedulingNightCode}")
    List<NursingSchedulingNightItem> getListByNursingSchedulingNightCode(@Param("nursingSchedulingNightCode")String nursingSchedulingNightCode);

    @Delete("delete from nursing_scheduling_night_item where NursingSchedulingNightCode=#{nursingSchedulingNightCode} ")
    int deleteByNurseSchedulingNightCode(String nursingSchedulingNightCode);

    @Select("select * from nursing_scheduling_night_item where NursingSchedulingNightCode=#{nursingSchedulingNightCode} and NurseAideCode=#{nurseAideCode} limit 1")
    NursingSchedulingNightItem getListByNursingSchedulingNightCodeAndNurseAideCode(@Param("nursingSchedulingNightCode") String nursingSchedulingNightCode,@Param("nurseAideCode") String nurseAideCode);

    @Select("select * from nursing_scheduling_night_item where NursingSchedulingNightCode=#{nursingSchedulingNightCode} and NurseCode=#{nurseCode} limit 1")
    NursingSchedulingNightItem getListByNursingSchedulingNightCodeAndNurseCode(@Param("nursingSchedulingNightCode") String nursingSchedulingNightCode,@Param("nurseCode") String nurseCode);
}
